<?php
$host = "localhost";
$port = 55556;


//connects to SFTPClient process to send a "put files" request
function put(){
	global $host, $port;
	$message = "Hi There";
	// create socket
	$socket = socket_create(AF_INET, SOCK_STREAM, 0) or
	 die("Could not create socket\n");
	 
	// connect to server
	$result = socket_connect($socket, $host, $port) or 
		die("Could not connect to server\n");
		
	//socket_read ($socket, 1024) or 
	//	die("Could not read server response\n");
		
	// send string to server
	socket_write($socket, $message, strlen($message)) or 
		die("Could not send	data to server\n");
		
	// get server response
	$result = socket_read($socket, 1024) or 
		die("Could not read server response\n");
	
	// end session
	//socket_write($socket, "END", 3) or
	//	die("Could not end session\n");
	
	// close socket
	socket_close($socket);
	
	// clean up result
	$result = trim($result);
	$result = substr($result, 0, strlen($result)-1);
	
	// print result to browser
	echo $result;
}

//connects to SFTPClient process to send a "get files" request
function get($serverPath, $clientPath){
	global $host, $port;
}

//connects to SFTPClient process to send a "list dir contents" request
function list($serverPath){
	global $host, $port;
}

?>